﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTest {
    public class TestHelper {
        public class FloatComparer : System.Collections.IComparer {
            public FloatComparer (float pre) {
                this.Precision = pre;
            }
            public float Precision { get; private set; }

            int System.Collections.IComparer.Compare (object x, object y) {
                var left = (float)x;
                var right = (float)y;
                if (right - left < -Precision)
                    return -1;
                else if (right - left < Precision)
                    return 0;
                else
                    return 1;
            }
        }

    }
}
